package com.calciominoBeta.Activity;

import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.view.MotionEvent;

import com.calciomio.app.R;
import com.google.android.gms.gcm.GoogleCloudMessaging;


public class Calciomio extends Activity implements Runnable {
	Thread mThread;
	Runnable mRunnable;
	boolean active = true;
	int mTime = 200;
	public static final String REG_ID = "regId";
	private static final String APP_VERSION = "appVersion";
	GoogleCloudMessaging gcm;
	static final String TAG = "Register Activity";
	String regId;

	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.splashscreen_activity);

	}

	@Override
	protected void onResume() {
		active = true;
		mTime = 200;
		super.onResume();
	}

	@Override
	public void onWindowFocusChanged(boolean hasFocus) {
		if (mThread == null) {
			mThread = new Thread(this);
			mThread.start();
		}
		super.onWindowFocusChanged(hasFocus);
	}

	@Override
	public void run() {
		try {
			while (active && mTime > 0) {
				mTime -= 10;
				Thread.sleep(20);

			}
		} catch (Exception e) {
		} finally {
			startActivity(new Intent(getBaseContext(), Main_Activity.class));
			finish();
		}

	}

	@Override
	public boolean onTouchEvent(MotionEvent event) {
		if (event.getAction() == MotionEvent.ACTION_DOWN) {
			active = false;
		}
		return super.onTouchEvent(event);
	}

	


}
